import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [

   {
    title: '控制类别',
    align:"center",
    dataIndex: 'kzlb'
   },
   {
    title: '控制名称',
    align:"center",
    dataIndex: 'kzmc',
     customCell: () => {
       return { style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } };
     },
   },
   {
    title: '控制值',
    align:"center",
    dataIndex: 'kzz'
   },
   {
    title: '默认值',
    align:"center",
    dataIndex: 'mrz'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'bz'
   },

];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '控制类别',
    field: 'kzlb',
    component: 'JInput',
    colProps: { span: 6 },
  },
  {
    label: '控制名称',
    field: 'kzmc',
    component: 'JInput',
    colProps: { span: 6 },
  },
  {
    label: '控制值',
    field: 'kzz',
    component: 'JInput',
    colProps: { span: 6 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [

  {
    label: '控制类别',
    field: 'kzlb',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入控制类别!'},
          ];
     },
  },
  {
    label: '控制名称',
    field: 'kzmc',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入控制名称!'},
          ];
     },
  },
  {
    label: '控制值',
    field: 'kzz',
    component: 'InputTextArea',
  },
  {
    label: '默认值',
    field: 'mrz',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'bz',
    component: 'Input',
  },

	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  iid: {title: '参数IID',order: 0,view: 'number', type: 'number',},
  kzlb: {title: '控制类别',order: 1,view: 'text', type: 'string',},
  kzmc: {title: '控制名称',order: 2,view: 'text', type: 'string',},
  kzz: {title: '控制值',order: 3,view: 'text', type: 'string',},
  mrz: {title: '默认值',order: 4,view: 'text', type: 'string',},
  bz: {title: '备注',order: 5,view: 'text', type: 'string',},
  xgbz: {title: '修改标志',order: 6,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
